package org.example.utils;

import java.io.Serializable;

public class MyRunnable implements Runnable, Serializable {
    private static final long serialVersionUID = 1L;
    private final int i;
    private final String id;

    public MyRunnable(String id, int i) {
        this.i = i;
        this.id = id;
    }

    @Override
    public void run() {
        try {
            // 模拟耗时操作
            Thread.sleep(500);
            System.out.println("请求" + id + "子线程" + i + "任务完成");
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
            System.err.println("请求" + id + "子线程" + i + "被中断: " + e.getMessage());
        }
    }
}
